﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCNgheNghiep.ascx.cs"
    Inherits="Viewer.NhanSu.UserControl.UCNgheNghiep" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/NhanSu/UserControl/UCTimNghe.ascx" TagName="UCTimNghe" TagPrefix="uc" %>
<link href="../../resources/css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    body
    {
        color: #57585B; /*dark gray*/
        font-size: 8px;
        font-family: Arial;
    }
</style>
<ext:XScript ID="XScipt1" runat="server">
    <script type="text/javascript">
        function FindEntityNghe(str)
        {
            if(#{txtCodeNghe}.getValue().trim() != ''){
            #{DirectMethods}.FindCommonName_NgheNghiep(str)
            }
            else{#{txtTenNgheNghiep}.setValue('');}
           
        }
         function InsertNghe(id,key,value) 
      { 
       
        if(  #{hdStatus}.getValue()=='TimNghe')
        {           
            #{txtTenNgheNghiep}.setValue(value);   
           #{hdNgheNghiepId_LookUp}.setValue(id);
            #{txtCodeNghe}.setValue(key);
           #{DirectMethods}.LoadChuyenNganh(id)
        }  
           Ext.net.Mask.hide();
        }
     
    </script>
</ext:XScript>
<ext:Window ID="wdNgheNghiep" runat="server" AutoHeight="true" Closable="false" Modal="true"
    Icon="TableCell" Width="400" Layout="Fit" AutoScroll="true" Hidden="true" Resizable="true"
    BodyCssClass="window">
    <Listeners>
    </Listeners>
    <Content>
        <ext:Panel ID="Panel1" runat="server" Frame="false" Border="false" AutoHeight="true"
            Icon="Information" BodyStyle="background-color: white;">
            <Content>
                <table width="100%">
                    <tr style="display: none;">
                        <td>
                            <ext:Hidden ID="hdParentType" runat="server" />
                            <ext:Hidden ID="hdType" runat="server" />
                            <ext:Hidden ID="hdNhanVienId" runat="server" />
                            <ext:Hidden ID="hdNgheId" runat="server" />
                            <ext:Hidden ID="hdNgheNghiepId_LookUp" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td width="100px">
                            Mã nghề
                        </td>
                        <td width="200px">
                            <ext:TextField ID="txtCodeNghe" runat="server" Width="200px" EmptyText="Mã nghề">
                                <Listeners>
                                    <Change Handler="FindEntityNghe(#{txtCodeNghe}.getValue());" Delay="250" />
                                </Listeners>
                            </ext:TextField>
                        </td>
                        <td width="100px">
                            <ext:Button ID="btn1" runat="server" Text="Tìm nghề" Icon="Find">
                                <Listeners>
                                    <Click Handler="Ext.net.Mask.show();MarkLookUp('TimNghe');#{DirectMethods}.LookUp_TimNghe();" />
                                </Listeners>
                            </ext:Button>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Nghề
                        </td>
                        <td>
                            <ext:TextField ID="txtTenNgheNghiep" runat="server" Width="200px" EmptyText="Tên nghề"
                                ReadOnly="true">
                                <ToolTips>
                                    <ext:ToolTip ID="ToolTip1" runat="server" AutoHide="true" TrackMouse="true">
                                        <Listeners>
                                            <Show Handler="ShowTip(this,#{txtTenNgheNghiep}.getValue())" />
                                        </Listeners>
                                    </ext:ToolTip>
                                </ToolTips>
                            </ext:TextField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Chuyên ngành
                        </td>
                        <td>
                            <ext:ComboBox ID="cbbChuyenNganh" runat="server" Width="200px" EmptyText="Chuyên ngành"
                                DisplayField="CodeValue" ValueField="CodeID">
                                <ToolTips>
                                    <ext:ToolTip ID="ToolTip2" runat="server" AutoHide="true" TrackMouse="true">
                                        <Listeners>
                                            <Show Handler="ShowTip(this,#{cbbChuyenNganh}.getValue())" />
                                        </Listeners>
                                    </ext:ToolTip>
                                </ToolTips>
                                <Store>
                                    <ext:Store ID="storeChuyenNganh" runat="server">
                                        <Reader>
                                            <ext:JsonReader>
                                                <Fields>
                                                    <ext:RecordField Name="CodeID" />
                                                    <ext:RecordField Name="CodeValue" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Store>
                                <Triggers>
                                    <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                </Triggers>
                                <Listeners>
                                    <Select Handler="this.triggers[0].show();" />
                                    <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                    <TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                </Listeners>
                            </ext:ComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Ngày bắt đầu
                        </td>
                        <td>
                            <ext:DateField Format="dd/MM/yyyy" ID="dtNgayBatDau" runat="server" AnchorHorizontal="100%"
                                Width="100" SelectedDate="">
                            </ext:DateField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Ngày kết thúc
                        </td>
                        <td>
                            <ext:DateField Format="dd/MM/yyyy" ID="dtNgayKetThuc" runat="server" AnchorHorizontal="100%"
                                Width="100" SelectedDate="">
                            </ext:DateField>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            Ghi chú
                        </td>
                        <td>
                            <ext:TextArea ID="txtGhiChu" runat="server" Width="200" />
                        </td>
                    </tr>
                </table>
            </Content>
        </ext:Panel>
    </Content>
    <Buttons>
        <ext:Button ID="btnSave" runat="server" Text="Lưu" Icon="Disk">
            <Listeners>
                <Click Handler="Ext.net.Mask.show();" />
            </Listeners>
            <DirectEvents>
                <Click OnEvent="btnSaveNghe_CLick">
                </Click>
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="Button1" runat="server" Text="Đóng" Icon="Cancel">
            <Listeners>
                <Click Handler="#{wdNgheNghiep}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>
<uc:UCTimNghe ID="UCTimNghe" runat="server" />
